package com.hy.medicine.enums;

import lombok.Getter;

/**
 * 库存变动类型枚举
 */
@Getter
public enum StockChangeTypeEnum {
    IN(1, "入库"),
    OUT(2, "出库"),
    ADJUST(3, "盘点调整");

    private final int code;
    private final String desc;

    StockChangeTypeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static StockChangeTypeEnum getByCode(int code) {
        for (StockChangeTypeEnum type : values()) {
            if (type.getCode() == code) {
                return type;
            }
        }
        return null;
    }
}
